<?php
namespace app\shop\model;

use app\BaseModel;
use think\facade\Db;
class IndexExtension extends BaseModel
{
	//定义表名

	protected $name = 'longbing_card_extension';


    /**
     * @param $data
     * @return int|string
     * 编辑名片主推
     *
     */
    public function extensionUpdate($dis,$data){
        $data['update_time'] = time();
        $res = $this->where($dis)->update($data);
        return $res;
    }

    /**
     * @param $dis
     * @return mixed
     * 取消名片主推
     */
    public function extensionDel($dis){
        $data = $this->where($dis)->delete();
        return $data;
    }


    /**
     * @param $data
     * @return int|string
     * 添加名片主推
     */
    public function extensionAdd($data){
        $data['create_time'] = time();
        $data['update_time'] = time();
        $res = $this->insert($data);
        return $res;
    }


    /**
     * @param $dis
     * @return array
     * 获取名片主推商品
     */
    public function extensionGoodsId($dis){
        $data = $this->where($dis)->column('goods_id');
        return $data;
    }

    /**
     * @param $dis
     * @return array|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * 获取名片主推
     */
    public function extensionInfo($dis){
        $data = $this->where($dis)->find();
        return !empty($data)?$data->toArray():$data;
    }




	


}